class grank extends BaseScreen {
    public constructor() {
        super();
        this.skinName = "resource/eui_skins/rank.exml";      
    }

	public backBtn:eui.Image;
	private rankList:eui.List;
	private scroller:eui.Scroller;
	private is_load:boolean = false;
	private next_load_time:number = 0;
	protected childrenCreated(): void 
    {
        super.childrenCreated();
		this.initView();
		this.initEvent();
    }

	private initView():void
	{
        this.rankList.itemRenderer = RankItem;
		this.is_load = true;
	}

	public refreshData():void
	{
		utils.Toast.instance.dispear();
		this.rankList.dataProvider = new eui.ArrayCollection(utils.CoreData.instance.rankData);
	}

	private initEvent():void
	{
		this.backBtn.addEventListener(egret.TouchEvent.TOUCH_TAP,this.backSceneHandle,this);
		pub.SignalManager.instance.addSignal(pub.SignalDefin.RECEIVE_RANK_DATA,this.receiveRankData,this);
	}

	private receiveRankData():void
	{
		this.refreshData();
	}

	private backSceneHandle():void
    {
		this.close_scene();
		pub.SignalManager.instance.dispatchSignal(pub.SignalDefin.CLOSE_RANK);
    }

	public show_scene():void{
		this.visible = true;
		if(this.next_load_time <= 0){
			utils.Toast.instance.showMsg('加载中...');
			utils.ServerManager.instance.requestRankData();
			this.next_load_time = egret.getTimer();
		}
	}

	public close_scene():void{
		// pub.SignalManager.instance.removeSignal(pub.SignalDefin.RECEIVE_RANK_DATA,this.receiveRankData,this);
		// this.backBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP,this.backSceneHandle,this);
		// pub.SignalManager.instance.dispatchSignal(pub.SignalDefin.REMOVE_RANK_SCENE);
		this.visible = false;
	}
}